﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using IterationLife.Domains.Sports.Models;

namespace IterationLife.Domains.Sports.Dtos.MTSports
{
    public class MTTeam
    {
        public int id { get; set; }

        public string name { get; set; }

        public DateTime? birthday { get; set; }

        public string logo { get; set; }

        public int teamPersonCnt { get; set; }
    }

    public static class MTTeamExtension
    {
        public static SportTeam ToSportTeam(this MTTeam team)
        {
            var result = new SportTeam(Guid.NewGuid());
            SetEntityValue(result, team);
            return result;
        }

        public static void SetEntityValue(SportTeam sportTeam, MTTeam mtTeam)
        {
            sportTeam.PartnerTeamId = mtTeam.id.ToString();
            sportTeam.Name = mtTeam.name;
            sportTeam.Logo = mtTeam.logo;
            sportTeam.CreationTime = mtTeam.birthday ?? DateTime.Now;
            sportTeam.PersonCount = mtTeam.teamPersonCnt;
        }
    }
}
